]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dnd: Get transformed size for scaling before unparenting drag actor
authorJonas Dreßler <verdre@v0yd.nl>
Tue, 20 Oct 2020 23:02:37 +0000 (01:02 +0200)
committerJonas Dreßler <verdre@v0yd.nl>
Tue, 20 Oct 2020 23:15:21 +0000 (01:15 +0200)
Commit de610a13f1ad1e7e34d4b9a81df58d4da3693059 in mutter made it
impossible to access the actors last allocation after unmapping it,
this broke the scale-up/down animation when starting a drag.

Fix that animation again by saving the actors transformed size before
unparenting (and therefore unmapping) the actor instead of afterwards.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1475

js/ui/dnd.js

index b1e1680f43c9988fe8ac281a5ad23606916516e4..f6debef584a279cf81874b55e98d1879bba5369b 100644 (file)
@@ -338,6 +338,8 @@ var _Draggable = class _Draggable {
         this._dragX = this._dragStartX = stageX;
         this._dragY = this._dragStartY = stageY;
 
+        let scaledWidth, scaledHeight;
+
         if (this.actor._delegate && this.actor._delegate.getDragActor) {
             this._dragActor = this.actor._delegate.getDragActor();
             Main.uiGroup.add_child(this._dragActor);
@@ -370,6 +372,8 @@ var _Draggable = class _Draggable {
 
             this._dragOffsetX = this._dragActor.x - this._dragStartX;
             this._dragOffsetY = this._dragActor.y - this._dragStartY;
+
+            [scaledWidth, scaledHeight] = this._dragActor.get_transformed_size();
         } else {
             this._dragActor = this.actor;
 
@@ -399,6 +403,9 @@ var _Draggable = class _Draggable {
             this._dragOffsetX = transformedExtents.origin.x - this._dragStartX;
             this._dragOffsetY = transformedExtents.origin.y - this._dragStartY;
 
+            scaledWidth = transformedExtents.get_width();
+            scaledHeight = transformedExtents.get_height();
+
             this._dragOrigParent.remove_actor(this._dragActor);
             Main.uiGroup.add_child(this._dragActor);
             Main.uiGroup.set_child_above_sibling(this._dragActor, null);
@@ -432,7 +439,6 @@ var _Draggable = class _Draggable {
             this._dragY + this._dragOffsetY);
 
         if (this._dragActorMaxSize != undefined) {
-            let [scaledWidth, scaledHeight] = this._dragActor.get_transformed_size();
             let currentSize = Math.max(scaledWidth, scaledHeight);
             if (currentSize > this._dragActorMaxSize) {
                 let scale = this._dragActorMaxSize / currentSize;